<%@page import="com.opensymphony.xwork2.ActionContext"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache">  
<meta http-equiv="cache-control" content="no-cache">  
<meta http-equiv="expires" content="0">    
<script type="text/javascript" src="<%= path %>/js/jquery.js"></script>
<title>验证码</title>
</head>
<body>
	<form action="" method="Post" id="form">
		<label for="indentifyCode">输入验证码：</label>
		<input type="text"  name="indentifyCode" id="indentifyCode"/>
		<img src="identifyCode"  id="identifyImage" onclick="changImgae(this)"/>
		<input type="submit"  value="提交"/>
	</form>
	
	<script type="text/javascript">
		function changImgae(obj){
			obj.src = obj.src+"?";
		}
		
		$(document).ready(function(){
			$("#form").submit(function(){
				var code = $("#indentifyCode").val();
				$.ajax({
					url:"login.action",
					dataType:"text",
					data:{indentifyCode:code},
					success:function(data){
						if(data=='true'){
							alert("验证码正确");
						}
						else{
							alert("验证码错误");
						}
					}
				});
				
				//禁止表单提交提交
				return false;
			});
		});
		
	</script>
</body>
</html>